<?php

/**
 * 网站编辑
 */
$title = '网站编辑';
include "header.php";
$pref = explode('/', $_SERVER['REQUEST_URI'])[1];
?>
<div class="row">
    <div class="col-xl-12">
        <div class="card">
            <div class="card-body">
                <div class="row">
                    <div class="col-md-12">
                        <h3 class="mb-3 header-title text-success"><?= $title ?></h3>
                        <form class="form-horizontal layui-form">
                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">网站名称</label>
                                <input type="text" name="sitename" lay-verify="required" class="form-control" value="<?= $conf['sitename'] ?>" placeholder="请输入站点名称">
                            </div>
                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">网站副标题</label>
                                <input type="text" name="title" lay-verify="required" class="form-control" value="<?= $conf['title'] ?>" placeholder="请输入网址副标题">
                            </div>
                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">网站关键词[SEO]</label>
                                <input type="text" name="keywords" lay-verify="required" class="form-control" value="<?= $conf['keywords'] ?>" placeholder="请输入站点名称">
                            </div>
                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">网站描述语[SEO]</label>
                                <input type="text" name="description" lay-verify="required" class="form-control" value="<?= $conf['description'] ?>" placeholder="请输入站点名称">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">邀请奖励</label>
                                <input type="text" name="award" lay-verify="required" class="form-control" value="<?= $conf['award'] ?>" placeholder="每邀请1人奖励的<?= $conf['currency'] ?>数量">
                            </div>
                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">货币名称</label>
                                <input type="text" name="currency" lay-verify="required" class="form-control" value="<?= $conf['currency'] ?>" placeholder="网站货币的名称">
                            </div>
                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">签到赠送</label>
                                <input type="text" name="Signin" lay-verify="required" class="form-control" value="<?= $conf['Signin'] ?>" placeholder="每天签到奖励的<?= $conf['currency'] ?>数量">
                            </div>
                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">免费商品或积分商品每日兑换限制<font color="red">(单一用户)</font></label>
                                <input type="text" name="getinreturn" lay-verify="required" class="form-control" value="<?= $conf['getinreturn'] ?>" placeholder="每日单一用户可用积分兑换商品的次数(包含免费商品)">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">免费商品或积分商品每日兑换限制<font color="red">(整个站点)</font></label>
                                <input type="text" name="getinreturn_all" lay-verify="required" class="form-control" value="<?= $conf['getinreturn_all'] ?>" placeholder="每日整个网站可用积分兑换商品的次数(包含免费商品)">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">API对接密钥</label>
                                <input type="text" name="secret" lay-verify="required" class="form-control" value="<?= $conf['secret'] ?>" placeholder="调用后台接口时使用！">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">下单违禁词 <font color="red">(若下单信息中包含下列关键词则无法购买商品,多个请使用英文逗号分割)</font></label>
                                <input type="text" name="blacklist" class="form-control" value="<?= $conf['blacklist'] ?>" placeholder="请使用英文逗号分割！">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">安全中心 <font color="red">关闭后不再记录用户访问日志,需安装对应插件</font></label>
                                <select class="custom-select mt-3" name="SecurityCenter">
                                    <option <?= $conf['SecurityCenter'] == 1 ? 'selected' : '' ?> value="1">开启整站日志监控
                                    </option>
                                    <option <?= $conf['SecurityCenter'] == -1 ? 'selected' : '' ?> value="-1">关闭整站日志监控
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">logo地址</label>
                                <div class="input-group">
                                    <input type="text" lay-verify="required" lay-verType="tips" class="form-control" name="logo" id="image" value="<?= $conf['logo'] ?>" placeholder="网站logo的地址" />
                                    <div class="input-group-append">
                                        <span class="input-group-text" id="upload" style="cursor: pointer">上传</span>
                                    </div>
                                    <div class="input-group-append">
                                        <span class="input-group-text" onclick="layer.alert('<img src=\''+$('#image').val()+'\' style=width:100%  />')" style="cursor: pointer;background-color: slateblue;color: white">预览</span>
                                    </div>
                                    <div class="input-group-append">
                                        <a href="http://cloud.79tian.com/s/e4KSo" target="_blank" class="input-group-text" style="cursor: pointer;background-color: #a8f46b;color: white">图库</a>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">商品分享海报获取方式 <font color="red">云端可生成多种随机样式 </font></label>
                                <select class="custom-select mt-3" name="share_image">
                                    <option <?= $conf['share_image'] == 1 ? 'selected' : '' ?> value="1">本地生成
                                    </option>
                                    <option <?= $conf['share_image'] == 2 ? 'selected' : '' ?> value="2">云端生成
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">启用订单队列 <font color="red">订单队列可有效缓解服务器压力,购物车付款默认开启！ </font></label>
                                <select class="custom-select mt-3" name="OredeQueue">
                                    <option <?= $conf['OredeQueue'] == 1 ? 'selected' : '' ?> value="1">不启用订单队列,下单后直接对接到货源
                                    </option>
                                    <option <?= $conf['OredeQueue'] == 2 ? 'selected' : '' ?> value="2">启用订单队列,先加入队列后对接货源
                                    </option>
                                </select>
                            </div>


                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">上传图片压缩比例 <font color="red">0.1=压缩到10%,1=不压缩</font></label>
                                <input type="text" name="compression" lay-verify="required" class="form-control" value="<?= $conf['compression'] ?>" placeholder="图片上传压缩比例,0.1=压缩到10%,1=不压缩">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">防重复订单配置(秒数限制) <font color="red">商品ID,下单信息,下单份数,全部相同则判断为同一订单!防止重复写入创建重复订单!</font></label>
                                <input type="text" name="OrderAstrict" lay-verify="required" class="form-control" value="<?= $conf['OrderAstrict'] ?>" placeholder="同信息商品下单间隔秒数(商品ID,下单信息,下单份数相同的订单)">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">强制用户登陆 <font color="red">开启后用户必须登陆用户后台才可以购买商品！ </font></label>
                                <select class="custom-select mt-3" name="ForcedLanding">
                                    <option <?= $conf['ForcedLanding'] == 1 ? 'selected' : '' ?> value="1">不开启用户强制登陆
                                    </option>
                                    <option <?= $conf['ForcedLanding'] == 2 ? 'selected' : '' ?> value="2">开启用户强制登陆(打开首页就跳转到登陆界面)
                                    </option>
                                    <option <?= $conf['ForcedLanding'] == 3 ? 'selected' : '' ?> value="3">开启用户强制登陆(只在下单的时候才提示需要登陆)
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">购物车开关 <font color="red">
                                        关闭后用户无法向购物车添加商品 </font></label>
                                <select class="custom-select mt-3" name="CartState">
                                    <option <?= $conf['CartState'] == 1 ? 'selected' : '' ?> value="1">开启购物车
                                    </option>
                                    <option <?= $conf['CartState'] == 2 ? 'selected' : '' ?> value="2">关闭购物车
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">下单失败后状态 <font color="red">
                                        包括但不限于,货源对接失败,自营商品下单,卡密商品发卡失败,api商品对接失败等所有失败状态！ </font></label>
                                <select class="custom-select mt-3" name="SubmitState">
                                    <option <?= $conf['SubmitState'] == 1 ? 'selected' : '' ?> value="1">已完成
                                    </option>
                                    <option <?= $conf['SubmitState'] == 2 ? 'selected' : '' ?> value="2">待处理
                                    </option>
                                    <option <?= $conf['SubmitState'] == 3 ? 'selected' : '' ?> value="3">异常中
                                    </option>
                                    <option <?= $conf['SubmitState'] == 4 ? 'selected' : '' ?> value="4">正在处理
                                    </option>
                                    <option <?= $conf['SubmitState'] == 5 ? 'selected' : '' ?> value="5">退款
                                    </option>
                                    <option <?= $conf['SubmitState'] == 6 ? 'selected' : '' ?> value="6">已评价(完结订单,无法申请售后)
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">下单成功后状态 <font color="red">包括但不限于,货源对接失败,自营商品下单,卡密商品发卡成功,api商品对接成功等所有成功状态！ </font></label>
                                <select class="custom-select mt-3" name="SubmitStateSuccess">
                                    <option <?= $conf['SubmitStateSuccess'] == 1 ? 'selected' : '' ?> value="1">已完成(点击状态可查看订单)
                                    </option>
                                    <option <?= $conf['SubmitStateSuccess'] == 2 ? 'selected' : '' ?> value="2">待处理(点击状态可补单)
                                    </option>
                                    <option <?= $conf['SubmitStateSuccess'] == 3 ? 'selected' : '' ?> value="3">异常中(点击状态可填写订单处理结果)
                                    </option>
                                    <option <?= $conf['SubmitStateSuccess'] == 4 ? 'selected' : '' ?> value="4">正在处理(点击状态可填写订单处理结果)
                                    </option>
                                    <option <?= $conf['SubmitStateSuccess'] == 5 ? 'selected' : '' ?> value="5">退款(点击状态可填写订单处理结果)
                                    </option>
                                    <option <?= $conf['SubmitStateSuccess'] == 6 ? 'selected' : '' ?> value="6">已评价(点击状态可查看订单)
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">首页数据缓存周期 <font color="red">整站每隔多少秒获取一次最新数据?,商品价格监控不受影响</font></label>
                                <input type="text" name="Homecaching" lay-verify="required" class="form-control" value="<?= $conf['Homecaching'] ?>" placeholder="首页分类,商品详细信息等杂七杂八的数据缓存周期">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">保底销量 <font color="red">
                                        销量数量计算规则：保底销量+真实销量</font></label>
                                <input type="text" name="SalesSum"  class="form-control" value="<?= $conf['SalesSum'] ?>" placeholder="销量数量计算规则：保底销量+真实销量">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">是否允许在QQ或微信内打开网站?</label>
                                <select class="custom-select mt-3" name="WeixQqValidation">
                                    <option <?= $conf['WeixQqValidation'] == 1 ? 'selected' : '' ?> value="1">不允许
                                    </option>
                                    <option <?= $conf['WeixQqValidation'] == 2 ? 'selected' : '' ?> value="2">允许
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">关闭网站 <font color="red">
                                        可填写关闭网站的原因,留空不关闭网站，只影响商城首页！</font></label>
                                <input type="text" name="CloseWebsite" class="form-control" value="<?= $conf['CloseWebsite'] ?>" placeholder="关闭网站的原因,留空不关站">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">客服二维码，用于联系客服，可上传微信或QQ的二维码（留空显示添加QQ好友的二维码哦）</label>
                                <div class="input-group">
                                    <input type="text" class="form-control" name="ServiceImage" id="image2" value="<?= $conf['ServiceImage'] ?>" placeholder="客服二维码" />
                                    <div class="input-group-append">
                                        <span class="input-group-text" id="upload2" style="cursor: pointer">上传</span>
                                    </div>
                                    <div class="input-group-append">
                                        <span class="input-group-text" onclick="layer.alert('<img src=\''+$('#image2').val()+'\' style=width:100%  />')" style="cursor: pointer;background-color: slateblue;color: white">预览</span>
                                    </div>
                                </div>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">腾讯云智服sign <font color="red">
                                        留空不显示</font>
                                    <a href="https://yzf.qq.com/" target="_blank">获取地址</a>
                                    <a href="javascript:layer.alert('第一步：点击旁边的获取地址进入云智服官网<br>第二步：注册,注册需要微信<br>第三步：登陆后台,登陆后可看提示操作<br>第四步：点击顶部设置按钮,渠道按钮选择网站渠道<br>第五步：点击新增网站按钮填写信息,填写完毕后可看到部署界面！<br>第六步：在链接地址里面找到你自己的sign！<br>如：https://yzf.qq.com/xv/web/static/chat/index.html?sign=长长的混合字符串<br>把sign后面的字符串复制下来,填在这里就行了！',{title:'云智服sign获取教程'})" style="color: #0bedcf">获取教程</a>
                                    <a href="https://yzf.qq.com/xv/html/admin/chat/home" target="_blank">会话管理地址</a>
                                </label>
                                <input type="text" name="YzfSign" class="form-control" value="<?= $conf['YzfSign'] ?>" placeholder="留空不显示！">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">客服QQ，用于添加客服QQ好友，方便售后</label>
                                <input type="text" name="kfqq" lay-verify="required" class="form-control" value="<?= $conf['kfqq'] ?>" placeholder="请输入客服QQ">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">官方群链接</label>
                                <input type="text" name="Communication" lay-verify="required" class="form-control" value="<?= $conf['Communication'] ?>" placeholder="请输入官方群链接">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">目录保护,开启后可使用账号密码登陆 <font color="red">
                                        可填写后台目录保护后缀，留空不开启，登陆时访问：<?= is_https(false) . href() . '/' . $pref . '/' . ($conf['Protect'] == '' ? '' : '?' . $conf['Protect']) ?>
                                        才可打开登陆界面！</font>，设置后请使用，域名/admin?目录密码，进入后台！</label>
                                <input type="text" name="Protect" class="form-control" value="<?= $conf['Protect'] ?>" placeholder="目录保护后缀，留空不保护！">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">用户账户密码登陆/注册</label>
                                <select class="custom-select mt-3" name="AccountPasswordLogin">
                                    <option <?= $conf['AccountPasswordLogin'] == 1 ? 'selected' : '' ?> value="1">开启
                                    </option>
                                    <option <?= $conf['AccountPasswordLogin'] == 2 ? 'selected' : '' ?> value="2">关闭
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">商品推荐开关（仅在购物车,商品详情,订单详情等界面下方出现哦）</label>
                                <select class="custom-select mt-3" name="GoodsRecommendation">
                                    <option <?= $conf['GoodsRecommendation'] == 1 ? 'selected' : '' ?> value="1">开启
                                    </option>
                                    <option <?= $conf['GoodsRecommendation'] == 2 ? 'selected' : '' ?> value="2">关闭
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal">新订单通知(邮件,是通知你，不是通知用户！) <a href="javascript:" onclick="layer.alert('若已经在小程序或APP绑定了可以正常接收邮件的QQ或者邮箱，即可收到通知！<br>若服务器速度较慢,可能会影响下单提交速度！')">说明</a></label>
                                <select class="custom-select mt-3" lay-search name="weix_notice">
                                    <option <?= $conf['weix_notice'] == -1 ? 'selected' : '' ?> value="-1">关闭新订单通知
                                    </option>
                                    <option <?= $conf['weix_notice'] == 1 ? 'selected' : '' ?> value="1">开启新订单通知
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">用户工单类型，多个可用英文逗号分割</label>
                                <input type="text" name="TicketsClass" class="form-control" value="<?= $conf['TicketsClass'] ?>" placeholder="工单类型，第一个必须是【订单问题】！">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">物流单号查询接口
                                    <a href="javascript:" onclick="layer.alert('<font color=red>问：在什么地方会用到？</font><br>答：首页用户订单查询管理界面<br><font color=red>问：如何设置订单的物流单号?</font><br>答：在站长后台，订单管理界面，点击订单最开头的备注按钮，按照格式填写即可识别出单号，如：物流单号|xxxxxxxxxxxxx（xxx是单号）<br><font color=red>Ps：默认为快递110的查询地址，可自定义，拼接格式：接口地址+物流单号</font>')">说明</a>
                                </label>
                                <input type="text" name="Tracking" class="form-control" value="<?= $conf['Tracking'] ?>" placeholder="拼接方式：<?= $conf['Tracking'] ?>识别的单号">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">用户被邀请后，必须消费多少，邀请者才可以领取奖励?，单位，元</label>
                                <input type="text" name="InviteValve" class="form-control" value="<?= $conf['InviteValve'] ?>" placeholder="邀请阈值">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal" style="font-weight: 500">商品默认标签名称,单文字1-4字即可，多个可用【|】分割！</label>
                                <input type="text" name="DefaultLabel" class="form-control" value="<?= $conf['DefaultLabel'] ?>" placeholder="商品默认标签名称,单文字1-4字即可">
                                <div style="padding: 0.2em;color: #1774ff">
                                    如果有需要可在文字后面设置背景颜色，如：官方,#ff0|质量,#00f，以此类推
                                </div>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal">站点动态消息通知提醒开关,如用户xxx于xxx购买了商品</label>
                                <select class="custom-select mt-3" lay-search name="DynamicMessage">
                                    <option <?= $conf['DynamicMessage'] == -1 ? 'selected' : '' ?> value="-1">关闭动态消息通知
                                    </option>
                                    <option <?= $conf['DynamicMessage'] == 1 ? 'selected' : '' ?> value="1">开启动态消息通知
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal">等级价格列表展示</label>
                                <select class="custom-select mt-3" lay-search name="LevelDisplay">
                                    <option <?= $conf['LevelDisplay'] == -1 ? 'selected' : '' ?> value="-1">关闭价格展示
                                    </option>
                                    <option <?= $conf['LevelDisplay'] == 1 ? 'selected' : '' ?> value="1">开启价格展示
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal">同分类商品推荐</label>
                                <select class="custom-select mt-3" lay-search name="SimilarRecommend">
                                    <option <?= $conf['SimilarRecommend'] == -1 ? 'selected' : '' ?> value="-1">关闭推荐
                                    </option>
                                    <option <?= $conf['SimilarRecommend'] == 1 ? 'selected' : '' ?> value="1">开启推荐
                                    </option>
                                </select>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal">用户系统开关</label>
                                <select class="custom-select mt-3" lay-search name="ShutDownUserSystem">
                                    <option <?= $conf['ShutDownUserSystem'] == -1 ? 'selected' : '' ?> value="-1">关闭用户系统
                                    </option>
                                    <option <?= $conf['ShutDownUserSystem'] == 1 ? 'selected' : '' ?> value="1">开启用户系统
                                    </option>
                                </select>
                                <div class="mt-1" style="color: red">关闭后用户将无法进入后台,并且同系统无法对接您的站点,用户只能够用游客状态购买您站点的商品!
                                </div>
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal">关闭用户系统的原因说明,开启时此项无效，填写纯文字！</label>
                                <input type="text" name="ShutDownUserSystemCause" class="form-control" value="<?= $conf['ShutDownUserSystemCause'] ?>" placeholder="关闭用户系统的原因">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal">APP下载地址（留空不显示）</label>
                                <input type="text" name="appurl" class="form-control" value="<?= $conf['appurl'] ?>" placeholder="请输入APP下载链接！">
                            </div>

                            <div class="form-group mb-3">
                                <label for="example-input-normal">前台商品,分类,文章每页数据数,默认6，建议不要低于6,否则可能会出现异常</label>
                                <input type="text" name="HomeLimit" class="form-control" value="<?= $conf['HomeLimit'] ?>" placeholder="请输入前台每页展现的数据数量！">
                            </div>

                            <div class="form-group mb-3" style="">
                                <label for="example-input-normal" style="position: relative;bottom: 0;left: 0">自定义导航（格式,跳转名称,跳转链接|跳转名称,跳转链接）</label>
                                <textarea class="form-control" name="navigation" lay-verify="required" rows="6" placeholder="格式,跳转名称,跳转链接|跳转名称,跳转链接"><?= $conf['navigation'] ?></textarea>
                            </div>


                            <button type="submit" lay-submit lay-filter="Web_editor" class="btn btn-block btn-xs btn-success">保存内容
                            </button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<?php include "bottom.php"; ?>

<script>
    layui.use('form', function() {
        var form = layui.form;
        form.on('submit(Web_editor)', function(data) {
            layer.alert('是否要执行当前操作？', {
                icon: 3,
                btn: ['确定', '取消'],
                btn1: function(layero, index) {
                    var index = layer.msg('数据保存中,请稍后...', {
                        icon: 16,
                        time: 999999
                    });
                    $.post('ajax.php?act=config_set', data.field, function(res) {
                        if (res.code == 1) {
                            layer.close(index);
                            layer.alert(res.msg, {
                                btn1: function(layero, index) {
                                    location.reload();
                                }
                            });
                        } else {
                            layer.close(index);
                            layer.alert(res.msg, {
                                btn1: function(layero, index) {
                                    location.reload();
                                }
                            });
                        }
                    });
                }
            });
            return false;
        })
    });
    layui.use(['upload', 'form'], function() {
        var upload = layui.upload;
        var uploadInst = upload.render({
            elem: '#upload' //绑定元素
                ,
            url: 'ajax.php?act=image_up' //上传接口
                ,
            done: function(res, index, upload) {
                layer.msg('图片上传成功');
                $("#image").val(res.src);
            },
            error: function() {
                layer.msg('图片上传失败!')
            }
        });

        var uploadInst = upload.render({
            elem: '#upload2' //绑定元素
                ,
            url: 'ajax.php?act=image_up' //上传接口
                ,
            done: function(res, index, upload) {
                layer.msg('图片上传成功');
                $("#image2").val(res.src);
            },
            error: function() {
                layer.msg('图片上传失败!')
            }
        });
    });
</script>